#pragma once 

#include <ftp_util.h>

constexpr int BLOCK_SIZE = 1024 * 4; // 4KB

class FTPFile {
public:
	FTPFile();

	bool open(const std::string& file, const std::string& mode);

	bool isOpen() {
		return file_ != nullptr;
	}

	bool close();

	int read(char* readBuf, size_t size);

	int write(const char* writeBuf, size_t size);

	~FTPFile();

	bool isWriteFinish() const {
		return offset_ == fileSize_;
	}

	void setOffset(size_t offset) {
		offset_ = offset;
	}

	std::string getFilename();

private:
	FILE* file_;
	size_t offset_;
	size_t fileSize_;
	std::string filename_;

};
